#cmake最低版本需求，不加入此行会受到警告信息
cmake_minimum_required(VERSION 2.6)

message(STATUS "******************************************************************")
message(STATUS "CMAKE_SOURCE_DIR->" ${CMAKE_SOURCE_DIR})
message(STATUS "PROJECT_SOURCE_DIR->)" ${PROJECT_SOURCE_DIR})
message(STATUS "******************************************************************")

project(SkyIPC) #项目名称

if(${PLATFORM} STREQUAL "rv1109")
    add_definitions(-DRV1109)
    add_definitions(-DPLATFORM="rv1109")
    SET(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
    SET(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
elseif(${PLATFORM} STREQUAL "dv300")
    add_definitions(-DDV300)
    add_definitions(-DPLATFORM="dv300")
    SET(CMAKE_C_COMPILER "arm-himix200-linux-gcc")
    SET(CMAKE_CXX_COMPILER "arm-himix200-linux-g++")
elseif(${PLATFORM} STREQUAL "x86")
    add_definitions(-DX86)
    add_definitions(-DPLATFORM="x86")
    add_definitions(-std=c++11)
    SET(CMAKE_C_COMPILER "gcc")
    SET(CMAKE_CXX_COMPILER "g++")
else()
    SET(CMAKE_C_COMPILER "gcc")
    SET(CMAKE_CXX_COMPILER "g++")
endif()

#设置c++标准
set(CMAKE_CXX_STANDARD 11)

#指定静态和动态文件目录
link_directories(${PROJECT_SOURCE_DIR}/lib )

#指定头文件目录
include_directories(./include)
include_directories(./src)

#把当前目录(.)下所有源代码文件和头文件加入变量SRC_LIST
aux_source_directory(./src SRC_LIST)

#生成应用程序
add_executable(sky ${SRC_LIST})

#链接指定的库
target_link_libraries(sky opensky)
